package com.rjhch.sparkTest

import org.apache.spark.{SparkConf, SparkContext}

object SparkTest1 {
  def main(args: Array[String]): Unit = {
    val conf=new SparkConf().setAppName("wordcount").setMaster("http://DONGPING-LMT:4040")
    val sc=new SparkContext(conf)
    val input=sc.textFile("D:\\tools\\spark-2.3.3-bin-hadoop2.7\\NOTICE")
    val lines=input.flatMap(line=>line.split(" "))
    val count=lines.map(word=>(word,1)).reduceByKey{case (x,y)=>x+y}
    val output=count.saveAsTextFile("D:\\TempFile\\hellosparkRes")
  }
}
